package com.rjt.common.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.rjt.exception.NoLoginException;

@ControllerAdvice
public class ExceptionHandController {
	 /**
     * 处理 Exception 异常
     *
     * @param httpServletRequest httpServletRequest
     * @param e                  异常
     * @return
     */
    @ExceptionHandler(value = NoLoginException.class)
    public String noLoginExceptionHandler(HttpServletRequest httpServletRequest, Exception e) {
    	return "redirect:/user/toLogin";
    }
    
    @ExceptionHandler(value = Exception.class)
    public String exceptionHandler(HttpServletRequest httpServletRequest, Exception e) {
    	return "redirect:/common/toError";
    }
}	
